package com.test.javacore;


/**
 * Created by jl on 2019/1/12 0012
 * hash map 的并发执行put操作时，当引起扩容后会导致oldtable 复制到 newtable
 * 这过程可能导致table中的冲突链变成环形链，当在进行get操作时如果传入的key不存在
 * 且正好被定位到这个环形链上就会导致无限循环
 */
public class HashMapDemo {
    static class Node {
        public Node next;

        public String data;

        public Node(Node next, String data) {
            this.next = next;
            this.data = data;
        }
    }

    public static void main(String[] args) {
        int[] a = {1, 2};
        Node first = new Node(null, "a");
        first.next = new Node(first, "b");
        Node e = first;
        do {
            if ("b".equals(e.data)) {
                return;
            }
        } while ((e = e.next) != null);
    }
}
